package com.gai.emp.services.impl;

import com.gai.emp.dao.EmpDao;
import com.gai.emp.entity.Emp;
import com.gai.emp.services.EmpServices;
import com.gai.emp.util.MybatisUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import java.util.List;

public class EmpServicesImpl implements EmpServices {
    /**
     * 分页查询所有
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageInfo<Emp> getAll(Integer pageNum, Integer pageSize) {
        EmpDao mapper = MybatisUtil.getMapper(EmpDao.class);
        PageHelper.startPage(pageNum, pageSize);
        List<Emp> all = mapper.getAll();
        PageInfo<Emp> pi = new PageInfo<>(all);
        return pi;
    }
}
